<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{$Think.config.WEB_SITE_TITLE} Power by 连云港信友科技有限公司 服务热线：400-000-9981</title>
<meta name="Keywords" content="连云港信友科技有限公司 服务热线：400-000-9981"/>
<meta name="Description" content="连云港信友科技有限公司 服务热线：400-000-9981"/> 
<!-- bootstrap - css -->
<link href="__PUBLIC__/BJUI/themes/css/bootstrap.min.css" rel="stylesheet">
<script src="__PUBLIC__/BJUI/js/jquery-1.7.2.min.js"></script>
<script src="__PUBLIC__/BJUI/js/jquery.PrintArea.js"></script>
</head>
<body>
<!-- core - css -->
<div class="container min_width1300"  id="printArea" style="text-align:center">
     <h3>{$Think.config.WEB_COMPANY_NAME}库存统计</h3>
     <table border="1"  width="100%" style="font-size:14px;">
            <thead>
                 <tr>
                    <th rowspan="2" data-order-field="id">ID</th>
                    <th rowspan="2" data-order-direction='desc' data-order-field='bianhao'>产品编号</th>
<th rowspan="2">产品名称</th>
<th rowspan="2">产品分类</th>
<th rowspan="2">产品规格</th>
<th rowspan="2">计量单位</th>
                <th colspan="3" align="center">{$_REQUEST['time1']}-{$_REQUEST['time2']}统计</th>
                </tr>
                <tr>
                    <th>入库</th>
                    <th>出库</th>
					<th  data-order-direction='desc' data-order-field='kucun'>库存</th>
                </tr>
            </thead>
            <tbody>
                <volist id="v" name="list">
          <tr>
<td>{$v.id}</td>
<td>{$v.bianhao}</td>
<td>{$v.title|msubstr=###,0,20}</td>
<td>{$v.fenlei|msubstr=###,0,20}</td>
<td>{$v.type|msubstr=###,0,20}</td>
<td>{$v.danwei|msubstr=###,0,20}</td>
<td>
<php>
if(isset($_REQUEST['time1']) && $_REQUEST['time1'] != ''&&isset($_REQUEST['time2']) && $_REQUEST['time2'] != ''){ $map['shijian'] =array(array('egt',I('time1').' 00:00:00'),array('elt',I('time2').' 59:59:59'));}
$where['bianhao']=array("eq",$v['bianhao']);
$map['_complex'] = $where;
echo M('rukus')->where($map)->sum('shuliang');
$where="";
$map="";
</php>
</td>
<td>
<php>
if(isset($_REQUEST['time1']) && $_REQUEST['time1'] != ''&&isset($_REQUEST['time2']) && $_REQUEST['time2'] != ''){ $map['shijian'] =array(array('egt',I('time1').' 00:00:00'),array('elt',I('time2').' 59:59:59'));}
$where['bianhao']=array("eq",$v['bianhao']);
$map['_complex'] = $where;
echo M('chukus')->where($map)->sum('shuliang');
$where="";
$map="";
</php>
</td>
<td>{$v.kucun}</td>

         </tr> 
          </volist>
            </tbody>
        </table>
				  
</div>
<div style="text-align:center;margin-top:50px;">
		<button type="button" id="print_btn" class="btn btn-primary">打印</button>&nbsp;
		<button type="button" onclick="javascript:window.close();" class="btn">关闭</button>
	   </div>
<script type="text/javascript">
/**
 * 打印
 **/
$('#print_btn').click(function(){
	$('#printArea').printArea();
	$(this).html('加载中 ...');
	setTimeout("$('#print_btn').html('打印');",1200);
});
</script>
 </body>
</html>